The Fine Print

Commands in an index entry are expanded when the index is typeset, not when the idx file is written. Hence, the command \index{\gnu} produces an entry that is alphabetized by \gnu, regardless of how the \gnu command is defined.

Recall that special characters like \ may appear in the argument of an \index command only if that command is not itself contained in the argument of another command. This is most likely to be a problem when indexing items in a footnote. Even in this case, robust commands can be placed in the ``@'' part of an entry, as in \index{gnu@{\it gnu}}, and fragile commands can be used if protected with the \protect command.3

Remember that the argument of an \index command must always have matching braces, where the brace in a \{ or \} command counts.

MakeIndex assumes that all page numbers are either arabic or lower-case roman numerals; it assumes that pages numbered with roman numerals precede those numbered with arabic numerals.

To put a !, @, or | character in an index entry, quote it by preceding the character with a ". More precisely, any a character is said to be quoted if it follows an unquoted " that is not part of a \" command. A quoted !, @, or | character is treated like an ordinary character rather than having its usual meaning. The " preceding a quoted character is deleted before the entries are alphabetized.

  Page 2: \index{exclaim ("!)}  
 Page 3: \index{exclaim ("!)!loudly}  
 Page 4: \index{fur@f\"{u}r}  
 Page 5: \index{quote (\verb+""+)}  


exclaim (!), 2 

loudly, 3
für, 4
quote (""), 5

MakeIndex regards spaces as ordinary characters when alphabetizing the entries and deciding whether two entries are the same. Thus, letting `` '' denote a space character, the commands \index{gnu}, \index{ gnu}, and \index{gnu } produce three separate entries, the first appearing near the beginning of the index, since comes before any letter in MakeIndex's ``alphabetical'' order. All three entries look the same when printed, since LATEX ignores extra spaces in the input. Similarly, \index{a space} and \index{a space} produce two different entries that look the same when printed. Do not split the argument of an \index command across lines in the input file.